package com.hadoop.mr.amiudake.max;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

public class MaxDriver {
	public static String NAME_NODE_URL = "hdfs://192.168.186.6:9000";

	public static void main(String[] args) throws Exception {
		
		Configuration conf = new Configuration();
		Job job = Job.getInstance(conf);

		job.setJarByClass(MaxDriver.class);
		job.setMapperClass(MaxMapper.class);
		job.setReducerClass(MaxReducer.class);

		job.setMapOutputKeyClass(Text.class);
		job.setMapOutputValueClass(Text.class);

		job.setOutputKeyClass(Text.class);
		job.setOutputValueClass(Text.class);

		FileInputFormat.setInputPaths(job, new Path(NAME_NODE_URL + "/mr/max.txt"));
		FileOutputFormat.setOutputPath(job, new Path(NAME_NODE_URL + "/mr/result/max"));
		job.waitForCompletion(true);
	}
}
